/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Ceci
 */
@Entity
@Table(name = "profesor")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Profesor.findAll", query = "SELECT p FROM Profesor p"),
    @NamedQuery(name = "Profesor.findByCedula", query = "SELECT p FROM Profesor p WHERE p.cedula = :cedula"),
    @NamedQuery(name = "Profesor.findByNombre", query = "SELECT p FROM Profesor p WHERE p.nombre = :nombre"),
    @NamedQuery(name = "Profesor.findByApellido", query = "SELECT p FROM Profesor p WHERE p.apellido = :apellido"),
    @NamedQuery(name = "Profesor.findByGrado", query = "SELECT p FROM Profesor p WHERE p.grado = :grado")})
public class Profesor implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "cedula")
    private Integer cedula;
    @Size(max = 2147483647)
    @Column(name = "nombre")
    private String nombre;
    @Size(max = 2147483647)
    @Column(name = "apellido")
    private String apellido;
    @Size(max = 2147483647)
    @Column(name = "grado")
    private String grado;
    @JoinColumn(name = "tema_idtema", referencedColumnName = "idtema")
    @ManyToOne(optional = false)
    private Tema temaIdtema;
    @JoinColumn(name = "sesion_idsesion", referencedColumnName = "idsesion")
    @ManyToOne(optional = false)
    private Sesion sesionIdsesion;
    @JoinColumn(name = "escuela_idescuela", referencedColumnName = "idEscuela")
    @ManyToOne(optional = false)
    private Escuela escuelaIdescuela;

    public Profesor() {
    }

    public Profesor(Integer cedula) {
        this.cedula = cedula;
    }

    public Integer getCedula() {
        return cedula;
    }

    public void setCedula(Integer cedula) {
        this.cedula = cedula;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getApellido() {
        return apellido;
    }

    public void setApellido(String apellido) {
        this.apellido = apellido;
    }

    public String getGrado() {
        return grado;
    }

    public void setGrado(String grado) {
        this.grado = grado;
    }

    public Tema getTemaIdtema() {
        return temaIdtema;
    }

    public void setTemaIdtema(Tema temaIdtema) {
        this.temaIdtema = temaIdtema;
    }

    public Sesion getSesionIdsesion() {
        return sesionIdsesion;
    }

    public void setSesionIdsesion(Sesion sesionIdsesion) {
        this.sesionIdsesion = sesionIdsesion;
    }

    public Escuela getEscuelaIdescuela() {
        return escuelaIdescuela;
    }

    public void setEscuelaIdescuela(Escuela escuelaIdescuela) {
        this.escuelaIdescuela = escuelaIdescuela;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cedula != null ? cedula.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Profesor)) {
            return false;
        }
        Profesor other = (Profesor) object;
        if ((this.cedula == null && other.cedula != null) || (this.cedula != null && !this.cedula.equals(other.cedula))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.Profesor[ cedula=" + cedula + " ]";
    }
    
}
